package com.demo.fulllink.service.impl;

import com.demo.fulllink.mapper.AccountMapper;
import com.demo.fulllink.module.po.AccountPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/storage/account")
public class StorageAccountAPIController {
    
    @Autowired
    private AccountMapper accountMapper;
    
    @RequestMapping("/findAll")
    public List<AccountPO> findAll() {
        return accountMapper.findAll();
    }
    
    @RequestMapping("/findByID/{accountId}")
    public AccountPO findByID(@PathVariable("accountId") Serializable accountId) {
        log.info("storage 服务 查询是否有账号");
        return accountMapper.findById(accountId);
    }
    
    @RequestMapping("/findByName/{accountName}")
    public AccountPO findByName(@PathVariable("accountName") Serializable accountName) {
        return accountMapper.findByName(accountName);
    }
    
}
